<?php
//  var_dump($_FILES);
//  move_uploaded_file($_FILES['files']['tmp_name'],'./upload/'.$_FILES['files']['name']);
   if(!empty($_POST)){
       if($_FILES['files']['error']==0){
            $name=uniqid('num').rand(0,100).$_FILES['files']['name'];
            move_uploaded_file($_FILES['files']['tmp_name'],'./upload/'.$name);
       }else{
           echo "上传失败";
       }
   }

?>




<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
     <form action="./文件上传.php" method="POST" enctype="multipart/form-data">
      <input type="file" name="files">
      <input type="submit" name="sub" value="上传">
     
     </form>
</body>
</html>